<?php
/**
 * @copyright meila.com
 * @author shaopu@
 * @name 
 * @param 
 *         $xxx = 作用
 * @static 
 *         XXX = 作用
 * 
 * 
 */
$dir = dirname(dirname(__FILE__));
include($dir.'/__queue_global.php');

class ml_mq_send_3rdweibo extends MqClass{
    const QUEUE_NAME = ML_QUEUENAME_SEND_3RDWEIBO;

    public function __construct($queue)
    {
        parent::__construct($queue);
    }
    
    public function run_job(){
        //接收的数据
        Tool_logger::debugLog('SENDWEIBO' , 'all' , true);
        
        $arr = $this->src_data;
        switch($arr['service_id']){
            case 1:
                $sendModel=new ml_model_openapiWeibo();break; 
            case 2:
                $sendModel= new ml_model_openapiQq();break;
            case 3:
                $sendModel= new ml_model_openapiRenren ();break;
            case 4:
                $sendModel= new ml_model_openapiKaixin ();break;
            default:
                return false;
        }
        //$arr['data']  /content    /picurl (非必须)   /access_token (非必须)
        $rs=$sendModel->sent_message($arr['data']);
        if(isset($rs['error']))
        {
            Tool_logger::debugLog('SENDWEIBO_FALSE' , $rs['error'] , true);
        }
        
        return true;
    }

}

ml_run_queue_check(ml_mq_send_3rdweibo::QUEUE_NAME);
$xblog_obj = new ml_mq_send_3rdweibo(new McQueue(ml_mq_send_3rdweibo::QUEUE_NAME));
$argv[1]   = __FILE__;
$xblog_obj->setArgv($argv[1]);
$xblog_obj->execute();
?>